home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Blogowanie poza sfera / Flock 0.9.1.3 stable / flock-0.9.1.3.en-US.win32.exe / flock / chrome / fbranding.jar / content / fbranding / overlay.js < prev    next >
Text File  |  2007-07-20  |  4KB  |  112 lines

  1. // BEGIN FLOCK GPL
  2. // 
  3. // Copyright Flock Inc. 2005-2007
  4. // http://flock.com
  5. // 
  6. // This file may be used under the terms of of the
  7. // GNU General Public License Version 2 or later (the "GPL"),
  8. // http://www.gnu.org/licenses/gpl.html
  9. // 
  10. // Software distributed under the License is distributed on an "AS IS" basis,
  11. // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. // for the specific language governing rights and limitations under the
  13. // License.
  14. // 
  15. // END FLOCK GPL
  16.  
  17. const FLOCK_DEFAULT_FEEDS_OPML = "chrome://flock/locale/feeds/opml/default.opml";
  18.  
  19. var firstRunOverlay = {};
  20.  
  21. firstRunOverlay.wizardFinished = function() {
  22.     dump ("foofoo: wizard has finished. Gonna reload tabs\n");
  23.     if (this.firstRunUrl) gBrowser.addTab(this.firstRunUrl);
  24.     gBrowser.mCurrentBrowser.loadURI(gBrowser.mCurrentBrowser.currentURI.spec + "?");
  25.  
  26.     // JMC - Time for A/B test
  27.     if ( flock_getBoolPref('browser.stats.sendAnonymous') &&
  28.         !flock_getCharPref('flock.photo.preferredServices') &&
  29.         (flock_getIntPref('flock.first_run.date') % 2) )
  30.     {
  31.         flock_topbarSelectById('flock_PhotoBrowseTopbarBroadcaster', true);
  32.         var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
  33.                             .createInstance(Components.interfaces.nsIXMLHttpRequest);
  34.         req.open('GET', brandingUtilities.buildWebsiteUrl('browser', 'firstrun', 'photobarOpened', 'none'), true);
  35.         req.send(null);
  36.     }
  37. }
  38.  
  39. top.addEventListener("load", function() {
  40.     var firstRunForBrowser = flock.firstrun.isFirstRunForComponent("browser_startup");
  41.     var firstRunForFeeds = flock.firstrun.isFirstRunForComponent("feeds_startup");    
  42.     if(firstRunForBrowser) {
  43.         flock_setCharPref("flock.first_run.bigDate", Date.now());
  44.         var aus = Components.classes["@mozilla.org/updates/update-service;1"]
  45.              .getService(Components.interfaces.nsIApplicationUpdateService);
  46.         aus.startupPing();
  47.  
  48.         var faves = Components.classes['@flock.com/favorites-service;1']
  49.              .getService(Components.interfaces.flockIFavoritesService);
  50.         faves.setupDefaultFavorites();
  51.  
  52. //@line 53 "/cygdrive/K/tinderbuild/src/flock/mozilla/browser/components/flock/branding/flock/content/overlay.js"
  53.         var wd = Cc['@flock.com/web-detective;1']
  54.           .getService(Ci.flockIWebDetective);
  55.         wd.checkForUpdates(true, null);
  56. //@line 57 "/cygdrive/K/tinderbuild/src/flock/mozilla/browser/components/flock/branding/flock/content/overlay.js"
  57.     }
  58.  
  59.     if (firstRunForFeeds) {
  60.         feedUtils.loadFeedsFromLocalOPML(FLOCK_DEFAULT_FEEDS_OPML);
  61.     }
  62.  
  63. }, false);
  64.  
  65.  
  66. function checkForPref(aPrefName)
  67. {
  68.     var prefSVC = Components.classes['@mozilla.org/preferences-service;1']
  69.                             .getService().QueryInterface(Components.interfaces.nsIPrefBranch);
  70.     return (prefSVC.getPrefType(aPrefName) && prefSVC.getBoolPref(aPrefName));
  71. }
  72.  
  73. function revertToOriginalToolbar() {
  74.     var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
  75.         getService(Components.interfaces.nsIRDFService);
  76.     var ds = rdfService.GetDataSource("rdf:local-store");
  77.     var node = rdfService.GetResource("chrome://browser/content/browser.xul#nav-bar");
  78.     var props=ds.ArcLabelsIn(node);
  79.     while(props.hasMoreElements()){
  80.         var prop=props.getNext();
  81.         var source=ds.GetSource(prop,node,true);
  82.         ds.Unassert(source,prop,node);
  83.     }
  84. }
  85.  
  86. function checkIfBuzzardUpgrade() {
  87.     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
  88.         .getService(Components.interfaces.nsIPrefBranch);
  89.  
  90.     // LOGIC: we only are doing a buzzard upgrade if the key doesn't exist
  91.     try {
  92.         var browserStartupKey = "flock.firstrun.components.browser_startup.completed";
  93.         var feedsStartupKey = "flock.firstrun.components.feeds_startup.completed";
  94.         var browserKeyExists = prefs.getBoolPref(browserStartupKey);
  95.         prefs.getBoolPref(feedsStartupKey);
  96.     } catch (ex) {
  97.         if (browserKeyExists) {
  98.             revertToOriginalToolbar();            // Buzzard upgrade if the browser first run ran, but feeds first run has not
  99.         }
  100.     }
  101. }
  102.  
  103. checkIfBuzzardUpgrade();
  104.  
  105. function incrementFlockLaunchCount(){
  106.   var launchCount = flock_getIntPref("flock.launch_count");
  107.   launchCount += 1;
  108.   flock_setIntPref("flock.launch_count",launchCount);
  109. }
  110.  
  111. incrementFlockLaunchCount();
  112.